import { request } from '@umijs/max';

export interface HotItem {
  word: string;
  url: string;
  index: number;
}
export interface HotTopic{
  hotTopic : HotItem[];
  wordCloud: string;
}

export const fetchDouyinHotTopics = async (): Promise<HotTopic> => {
  const response = await request('/api/hot_topic/douyin',{method: 'GET'})
  const {data} = await response;
  return data ;
};

export const fetchWeiboHotTopics = async (): Promise<HotTopic> => {
  const response = await request('/api/hot_topic/weibo',{method: 'GET'})
  const {data} = await response;
  return data;
};

export const fetchBaiduHotTopics = async (): Promise<HotTopic> => {
  const response = await request('/api/hot_topic/baidu',{method: 'GET'})
  const {data} = await response;
  return data;
};
